package com.cn.por.biz.bigtable.controller;
import com.cn.por.biz.bigtable.dto.BigTableDTO;
import cn.hsa.base.web.vo.PageResultData;
import cn.hsa.base.web.BaseController;
import cn.hsa.base.web.vo.WrapperResponse;
import com.cn.por.biz.bigtable.service.BigTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
 * <p>控制器</p>
 * @author xw
 * @since 2025-06-02
 */
@RestController
@RequestMapping("/web/bigtable/bigTable")
@Api(tags = "")
public class BigTableController extends BaseController  {

    @Autowired
    private BigTableService bigTableService;

    @PostMapping("/add")
    @ApiOperation(value = "新增")
    public WrapperResponse<BigTableDTO> addBigTable(@RequestBody BigTableDTO bigTableDTO){
      BigTableDTO result = bigTableService.add(bigTableDTO);
      return WrapperResponse.success(result);
    }
    

    @PostMapping("/edit")
    @ApiOperation(value = "修改")
    public WrapperResponse<BigTableDTO> updateBigTable(@RequestBody BigTableDTO bigTableDTO){
      BigTableDTO result = bigTableService.update(bigTableDTO);
      return WrapperResponse.success(result);
    }
    

    @GetMapping("/delete")
    @ApiOperation(value = "作废")
    public WrapperResponse<Boolean> deleteBigTable(@RequestParam String id){
      Boolean result = bigTableService.delete(id);
      return WrapperResponse.success(result);
    }
    

    @GetMapping("/item")
    @ApiOperation(value = "获取")
    public WrapperResponse<BigTableDTO> getBigTable(String id){
      BigTableDTO result = bigTableService.get(id);
      return WrapperResponse.success(result);
    }
    

    @PostMapping("/page")
    @ApiOperation(value = "获取分页")
    public WrapperResponse<PageResultData<BigTableDTO>> getPageBigTable(@RequestParam Integer pageNo,@RequestParam Integer pageSize,@RequestBody BigTableDTO bigTableDTO){
      PageResultData<BigTableDTO> result = bigTableService.getPage(pageNo,pageSize,bigTableDTO);
      return WrapperResponse.success(result);
    }
    
}